import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn,Index } from "typeorm";
import { PartnerStatus } from "../interfaces/IPartner.interface";
import { UserInfo } from "./user.entity";

@Entity()
export class PartnerInfo{
    @PrimaryGeneratedColumn({type:'int',name:'id',comment:"自增id"})
    id:number;

    @Index('partner_serial')
    @Column('varchar',{length:32,comment:"项目编码"})
    serialNo:string;

    @Index('partner_name')
    @Column('varchar',{length:50,comment:"项目名称"})
    name:string;

    @OneToOne(type=>UserInfo)
    @JoinColumn()
    /**创建人信息 */
    originator:UserInfo;

    @Column({type:'int',comment:"添加项目的时间戳"})
    addtime:number;

    @Column({type:'int',comment:"项目结束的时间戳"})
    endtime:number;

    @Index('partner_type_id')
    @Column('varchar',{comment:"项目类型"})
    typeId:number;

    @Column({type:'int',comment:"项目状态",default:PartnerStatus.Ongoing})
    status:number;

    @Column({type:'int',comment:"最小参与人数",default:2})
    min:number;

    @Column({type:'int',comment:"最大参与人数"})
    max:number;

    @Column({type:'int',comment:"已参与人数"})
    now:number;

    @Column({type:'decimal',scale:2,comment:"报名费用"})
    joinFee:number;

    @Column('text',{comment:"项目描述"})
    des:string;

    @Column('varchar',{length:512,comment:"缩略图片地址"})
    thumbnailImage:string;

    @Column('varchar',{length:512,comment:"项目详情图片地址"})
    detailsImage:string;

    @Column({type:'int',comment:"是否已启用拼团"})
    groupEnable:number;

    @Column({type:'int',comment:'拼团-成团人数',default:0})
    groupNum:number;

    @Column({type:'int',comment:'拼团-成团时效',default:0})
    groupAging:number;
}